import router from './index'
import store from '@/store'

const white=['/login']
router.beforeEach((to,from,next)=>{
    if(store.getters.token){
        if (to.path==='/login') {
            next('/')
        }else{
            next()
        }
    }else{
        if(white.includes(to.path)){
            next()
        }else{
            next('/login')
        }
    }
})